package com.pxc.fbbf;

import com.pxc.AppConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Description:
 *
 * @author pxc
 * Date: 2020-05-16
 * Time: 14:15
 */
public class Test {
	public static void main(String[] args) {
		/*
		 * 如果类实现了FactoryBean，那么spring容器中会创建两个对象
		 * 一个是getObject的对象，一个是本身
		 *
		 * @Component的名称是getObject的对象
		 * 当前对象需要用&+@Component的名称
		 *
		 */
		AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(AppConfig.class);
		TempDaoFactoryBean tempDaoFactoryBean = (TempDaoFactoryBean) context.getBean("daoFactoryBean");
		DaoFactoryBean daoFactoryBean =(DaoFactoryBean) context.getBean("&daoFactoryBean");
		tempDaoFactoryBean.testBean();
		daoFactoryBean.testBean();
	}
}
